<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>demo-自定义指令</title>
    <script src="../vue3.js"></script>
</head>
<body>
<div id="application">
    <input v-render-placeholder:custom='"达瓦达瓦"' >
    <my-input :placeholder="'哈哈哈'" v-focus></my-input>
</div>
<script>
    const app = Vue.createApp({});
    app.directive("renderPlaceholder", {
        mounted(elem, param) {
            console.log(param.arg)
            console.log(param.value)
            elem.placeholder = param.value
        }
    })
    const myInput = {
        provide(){

        },
        props: {
            "placeholder": String
        },
        template: "<input v-focus :placeholder='this.placeholder'>",
        directives: {
            focus: {
                mounted(elem) {
                    console.log("组件挂载！")
                    elem.focus()
                }
            }
        }
    }
    app.component("my-input", myInput)
    app.mount("#application")
</script>
</body>
</html>